package com.adroiti.texasholdem.engine.combinations;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import com.adroiti.texasholdem.Card;

public class High  extends AbstractCombination{

	@Override
	public int getRank(List<Card> player, List<Card> table) {
		List<Card> cards = new LinkedList<Card>(player);
		cards.addAll(table);
		
		Collections.sort(cards, Collections.reverseOrder());
		
		int rank = 0;
		/*
		 * Tool to make higher cards count most
		 */
		int num = cards.size();
		
		for(int i = 0; i < cards.size(); i++){
			rank += cards.get(i).getRank() * (num - i);
		}
		
		return rank;
	}

	@Override
	public String getName() {
		return "High card";
	}

	@Override
	public int getCombinationRank() {
		return 1;
	}

}
